package com.johnguo;

import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.handler.LoggingHandler;

@EnableBinding(Sink.class)
public class LogSink {

  @Bean
  @ServiceActivator(inputChannel = Sink.INPUT)
//  @ServiceActivator(inputChannel = Source.OUTPUT)
//  @StreamListener
  public LoggingHandler logSinkHandler() {
//		System.out.println(ServiceActivator.this.inputChannel());
		LoggingHandler loggingHandler = new LoggingHandler(LoggingHandler.Level.INFO);
		loggingHandler.setLoggerName("org.kun.LogSink");
		return loggingHandler;
  }

}